home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / CLRVWPRT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  887 b   |  36 lines

  1.  
  2.                                         /* File       : clrvwprt.c ( clearviewport ) */
  3.                                         /* Entered by : A. Wayner */
  4. # include <graphics.h>
  5.  
  6. main()
  7. {
  8.     int graphdriver = DETECT, graphmode;
  9.  
  10.                                             /* Detect adapter type and initialize */
  11.                                             /* graphics system */
  12.     initgraph( &graphdriver, &graphmode, "\\turboc" );
  13.     outtextxy( 10, 10, "Press any key to clear viewport");
  14.  
  15.                                             /* Define a viewport and draw something */
  16.                                             /* in it */
  17.     setviewport( 100, 50, getmaxx() - 100, getmaxy() - 60, 1 );
  18.  
  19.                                             /* Draw outline of the viewport */
  20.     rectangle( 0,0, getmaxx() - 200, getmaxy() - 110 );
  21.  
  22.  
  23.     bar( 50, 50, 100, 100 );
  24.     getch();
  25.     clearviewport();
  26.     outtextxy( 10, 10, "Notice only viewport was cleared");
  27.  
  28.                                             /* Wait until user presses a key */
  29.     outtextxy( 10, getmaxy() - 50, "Press any key to exit");
  30.  
  31.     getch();
  32.     closegraph();
  33. }
  34.  
  35.  
  36.